﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Runtime.CompilerServices;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using LiveCharts.Definitions.Series;
using LiveCharts.SeriesAlgorithms;
using LiveCharts.Wpf;

namespace LiveCharts.Wpf
{
	// Token: 0x02000026 RID: 38
	public class GStackedAreaSeries : GLineSeries, ISeriesView, IStackedAreaSeriesView, ILineSeriesView, IStackModelableSeriesView
	{
		// Token: 0x06000184 RID: 388 RVA: 0x00002F1B File Offset: 0x0000111B
		public GStackedAreaSeries()
		{
			base.Model = new StackedAreaAlgorithm(this);
			this.method_1();
		}

		// Token: 0x06000185 RID: 389 RVA: 0x00002F35 File Offset: 0x00001135
		public GStackedAreaSeries(object configuration)
		{
			base.Model = new StackedAreaAlgorithm(this);
			base.Configuration = configuration;
			this.method_1();
		}

		// Token: 0x17000042 RID: 66
		// (get) Token: 0x06000186 RID: 390 RVA: 0x00002F56 File Offset: 0x00001156
		// (set) Token: 0x06000187 RID: 391 RVA: 0x00002F68 File Offset: 0x00001168
		public StackMode StackMode
		{
			get
			{
				return (StackMode)base.GetValue(GStackedAreaSeries.StackModeProperty);
			}
			set
			{
				base.SetValue(GStackedAreaSeries.StackModeProperty, value);
			}
		}

		// Token: 0x06000188 RID: 392 RVA: 0x0000AA44 File Offset: 0x00008C44
		public override void OnSeriesUpdateStart()
		{
			base.ActiveSplitters = 0;
			if (base.SplittersCollector == 2147483646)
			{
				base.Splitters.ForEach(ls=>ls.SplitterCollectorIndex=0);
				base.SplittersCollector = 0;
			}
			int splittersCollector = base.SplittersCollector;
			base.SplittersCollector = splittersCollector + 1;
			if (base.Figure != null && base.Values != null)
			{
				double x = ChartFunctions.ToDrawMargin(base.Values.GetTracker(this).XLimit.Min, AxisOrientation.X, base.Model.Chart, base.ScalesXAt);
				if (base.Model.Chart.View.DisableAnimations)
				{
					base.Figure.StartPoint = new Point(x, base.Model.Chart.DrawMargin.Height);
				}
				else
				{
					base.Figure.BeginAnimation(PathFigure.StartPointProperty, new PointAnimation(new Point(x, base.Model.Chart.DrawMargin.Height), base.Model.Chart.View.AnimationsSpeed));
				}
			}
			if (base.IsPathInitialized)
			{
				base.Model.Chart.View.EnsureElementBelongsToCurrentDrawMargin(base.Path);
				base.Path.Stroke = base.Stroke;
				base.Path.StrokeThickness = base.StrokeThickness;
				base.Path.Fill = base.Fill;
				base.Path.Visibility = base.Visibility;
				base.Path.StrokeDashArray = base.StrokeDashArray;
				return;
			}
			base.IsPathInitialized = true;
			base.Path = new Path
			{
				Stroke = base.Stroke,
				StrokeThickness = base.StrokeThickness,
				Fill = base.Fill,
				Visibility = base.Visibility,
				StrokeDashArray = base.StrokeDashArray
			};
			PathGeometry pathGeometry = new PathGeometry();
			base.Figure = new PathFigure();
			pathGeometry.Figures.Add(base.Figure);
			base.Path.Data = pathGeometry;
			base.Model.Chart.View.AddToDrawMargin(base.Path);
			double x2 = ChartFunctions.ToDrawMargin(base.ActualValues.GetTracker(this).XLimit.Min, AxisOrientation.X, base.Model.Chart, base.ScalesXAt);
			base.Figure.StartPoint = new Point(x2, base.Model.Chart.DrawMargin.Height);
			int num = base.Model.Chart.View.Series.IndexOf(this);
			Panel.SetZIndex(base.Path, base.Model.Chart.View.Series.Count - num);
		}

		// Token: 0x06000189 RID: 393 RVA: 0x0000AD28 File Offset: 0x00008F28
		private void method_1()
		{
			base.SetCurrentValue(LineSeries.LineSmoothnessProperty, 0.7);
			base.SetCurrentValue(LineSeries.PointGeometrySizeProperty, 0.0);
			base.SetCurrentValue(LineSeries.PointForegroundProperty, Brushes.White);
			base.SetCurrentValue(Series.ForegroundProperty, new SolidColorBrush(Color.FromRgb(229, 229, 229)));
			base.SetCurrentValue(Series.StrokeThicknessProperty, 0.0);
			base.DefaultFillOpacity = 1.0;
			Func<ChartPoint, string> value = new Func<ChartPoint, string>(this.method_2);
			base.SetCurrentValue(Series.LabelPointProperty, value);
			base.Splitters = new List<LineSegmentSplitter>();
			
		}

		// Token: 0x0600018B RID: 395 RVA: 0x00002D24 File Offset: 0x00000F24
		[CompilerGenerated]
		private string method_2(ChartPoint chartPoint_0)
		{
			return base.Model.CurrentYAxis.GetFormatter()(chartPoint_0.Y);
		}

		// Token: 0x04000118 RID: 280
		public static readonly DependencyProperty StackModeProperty = DependencyProperty.Register("StackMode", typeof(StackMode), typeof(GStackedAreaSeries), new PropertyMetadata(StackMode.Values, Series.CallChartUpdater(false)));
	}
}
